package com.yunquan.ohana.ui.calendar

import android.os.Bundle
import androidx.core.content.ContextCompat
import androidx.core.view.WindowInsetsControllerCompat
import com.yunquan.ohana.BR
import com.yunquan.ohana.R
import com.yunquan.ohana.base.ui.BaseActivity
import com.yunquan.ohana.databinding.ActivityCalendarMenuBinding
import com.yunquan.ohana.ui.calendar.adapter.EventAdapter
import java.util.Locale

class CalendarMenuActivity : BaseActivity<ActivityCalendarMenuBinding, CalendarMenuViewModel>() {

    override fun initContentView(savedInstanceState: Bundle?): Int {
        return R.layout.activity_calendar_menu
    }

    override fun initVariableId(): Int {
        return BR.calendarMenuViewModel
    }

    override fun initParam() {
        super.initParam()
        Locale.setDefault(Locale("en"))
        // 设置背景颜色
        window.statusBarColor = ContextCompat.getColor(this, R.color.c_F6)
        // 设置文字颜色（true = 黑色文字，false = 白色文字）
        val controller = WindowInsetsControllerCompat(window, window.decorView)
        controller.isAppearanceLightStatusBars = true
    }

    override fun initData(savedInstanceState: Bundle?) {
        super.initData(savedInstanceState)
        binding!!.eventAdapter = EventAdapter()
        val bundle = intent.extras
        bundle?.let {
            viewModel!!.title.set(it.getString("deviceName"))
            viewModel!!.mDeviceId = it.getString("deviceId")
        }
    }

    override fun initViewObservable() {
        super.initViewObservable()
    }
}